isamuch - 2MA Cross and Stop Lossสัญญาณซื้อ/ขาย : มาจาก Moving Average สองเส้นตัดกัน
Stop Loss : มาจากราคาต่ำสุด/สูงสุดของช่วงระหว่าง Moving Average สองเส้นตัดกันก่อนหน้ากับ Moving Average ตัดกันปัจจุบัน
Recherche dans les scripts pour "stop loss"
Parabolic SAR Strategy With take profit and stop lossDo not make it too difficult!
This is my first strategy! I took the Parabolic SAR Strategy and added Stop Loss and Take profit, and I can see some fantastic results in 2h-3h-4h on some of the Crypto coins.
This is for training only, and I do not recommend using it as part of a trading bot, however, I do myself.
MultiPrice AlertThis is an alert script using Pinescript version 4. This enables one to set 5 alerts (1 StopLoss, 4 Targets), on 3 different symbols, at using a single alert in the UI.
Every visible line will only appear on the symbols that are selected. After setting targets when making an alert, select this indicator as a condition. Change the name to whatever you want, usually the names of the set of tickers.
The Alert message is dyanmic showing which Symbol with each type of alert, at whatever price.
Ability to disable the targets + symbols.
Alerts work by Stop Loss crossing under price and Targets Cross Over. Enabling the "Short" Targets reverses this.
The line that is being displayed is actually the price of the asset being moved over x number of bars. I have not found a way to plot a traditional horizontal line, as the code for it uses a fixed price.
As it being a user input, it is a variable. Any help with this would be appreicated.
Alerts are set to once per bar.
Known bug that sometimes if the prices that you set are inside the current candle stick, then your alert will immeaditally fire, either change the timeframe or let it fire and wait fo
After a target is hit, I reccomend setting the alert to 0 and REMAKING the alert. You MUST REMAKE THE ALERT AFTER ANY CHANGES. This script WILL NOT CHANGE ALERTS AS YOU CHANGE SETTINGS.
TradingView Alerts are not this smart , at least I haven't found a way to do this yet.
Anti-Volume Stop Loss multi timeframe [LM]Hello Traders,
I would like to introduce you fork of popular indicator Anti-Volume Stop Loss created by Buff Dormeier and cracked here on tradingview by @Rafka so shout out to him. I have tried to crack it myself as well as I'm big fan of Dormeier's work but it's not easy so really big thanks to Rafka
I have refactored original script and have included multi timeframe setting.
As its shown below you can select higher timeframe to track lower one:
Enjoy!
Bitlinc MARSI Study AST w/ Take Profit & Stop loss - beta 0.1This script is beta 0.1 - will update as soon as the script is tradable
This script is based on AST on a 10 minute timeframe. You can change the asset and the timeframe for any asset you want to trade, but for it to work correct ALL settings have to be testes in the Strategy section of the TradingView. Each assets and timeframe require a different mixture of settings. This is NOT a one settings fits all trading for all assets on any timeframe. Below are the settings and explanation on how it works.
How it fires a buy / sell:
The script will plot an RSI with upper and lower bands in a separate indicator window. The idea behind this script is to fire a LONG when MA crosses OVER lower band and fire a SHORT when the MA crosses under the lower band. Each order that fires is an OCO (Order Cancels Order) for pyramiding.
Settings:
You have full control of these settings as mentioned above, you must configure every part of this script for each asset and timeframe you trade.
- Length of MA
- Length
- Upper bands of RSI
- Lower bands of RSI
- Take profit percentage
- Stop loss percentage
- Month to start and end the strategy (within 2020)
- Day to start and end the strategy (within 2020)
- Quantity type
- Slippage
- Pyramiding
***Remember that after the signal to enter or exit a trade is fired, the alert will trigger AFTER the close of the candle that caused the tigger to fire
ATR Stop Loss LONG/SHORT by melihgulerYou can monitor the stop loss level according to ATR in 2 ways (Long/Short).
RSI + EMA+ MTF Stop-LossThis is a simple RSI with multiple MTF (No security) to help with direction short and long-term.
The rsi for the current chart has a noise reduction, while the rest are based on ma's.
I have supplied an extra flexible mtf rsi ma for potential adjustable/long-term stop-loss or direction identification.
Enjoy
RSI Stop LossExperiment for using RSI as a stop loss value, shows where the price will be when the RSI increases or decreases by a specified amount.
poki buy and sell Take profit and stop lossThis indicator is based on modelius model of lazy bear weis model with ATR for the buy=B sell =S
in addition there is Take profit and stop loss in % both for short and for long
next stage is to know the resistance level and support based on bollinger marked in blue and red dots
Also included Parabolic Sar (blue and red dots rising up or down)
The color of bulish or bearish zone is based on the cross of Hull avreage and linear regression ( for each time set may need different setting for accuracy )
So how to use this scrupt to better profit
1. if you have B signal and its on lower support level then its good starting place for buy. look at the Parabolic Sar if its in agreement. The exit can be either by S =sell, Take profit that you decide on % or by end of Parabolic SAR upward
2. exact the oposite for short
Play with setting for the desired results or change modify this script for your purpose
Pivot Stop LossHere we intend to use pivot points for stop loss and take profit. This has the added benefit of helping you to visualize support and resistance levels.
Hull modelius take profit and stop lossThis model has Hull moving average, fibs in form of Bollinger ,SMA and Modelius model with ATR for buy and sell power based on weis volume. Inside alerts for buy and sell. take profit and stop loss for both longs and shorts
so have fun
SL + TP Dynamics - By M.LolasStop Loss e Take Profit dinâmicos para operações semiautomatizadas.
By M.Lolas
STOP-LOSS-RSI with Edge-Preserving Filter Strategy V2Modified RSI strategy with entry and exit points.
I have allowed for High and Low risk for anyone interested in using it (NO GUARANTEES. DO YOUR OWN RESEARCH).
I will later consider incorporating the standard RSI for exit points. I am sure returns will increase based on current test runs :)
Returns look good based on the strategy result.
Multi-MA SuiteMulti-MA Suite - Customizable Moving Averages Indicator
Overview
Multi-MA Suite is a comprehensive moving average indicator that combines both Exponential Moving Averages (EMAs) and Simple Moving Averages (SMAs) in a single, highly customizable tool. Designed for traders who rely on multiple timeframe analysis, this indicator provides up to 9 moving averages (5 EMAs + 4 SMAs) with full control over visibility, color schemes, and parameters.
Key Features
✓ Dual MA Types:
5 Exponential Moving Averages (EMAs) - Responsive to recent price action, ideal for short to medium timeframes
4 Simple Moving Averages (SMAs) - Slow and stable, specifically designed for long timeframe analysis
✓ Full Customization:
Individual toggle switches to show/hide each moving average
Custom color picker for each MA line
Adjustable length and source for all moving averages
Progressive line width (thicker lines for longer periods)
✓ Pre-configured Defaults:
EMA: 9, 21, 50, 100, 200 (common swing trading periods)
SMA: 50, 100, 200, 300 (institutional reference levels for long-term trends)
Color-coded scheme: Warm colors (yellow-orange) for EMAs, Cool colors (blue-purple) for SMAs
✓ Clean Interface:
Organized input groups for easy navigation
Clear labeling and logical parameter ordering
Minimal chart clutter with toggle controls
Key Difference - Speed & Timeframe:
EMAs: Fast and reactive → Best for short to medium timeframes (1-min to 4-hour charts)
SMAs: Slow and smooth → Best for long timeframes (daily, weekly, monthly charts)
Recommended Settings
Day Trading (Short Timeframes):
Focus on EMAs: 9, 21, 50
Use 1-minute to 15-minute charts
SMAs react too slowly for intraday timeframes
Swing Trading (Medium Timeframes):
Use all EMAs with SMA 50 and 200
1-hour to daily charts work best
Mix of EMAs for entries, SMAs for trend context
Position Trading (Long Timeframes):
Focus primarily on SMAs: 50, 100, 200, 300
Daily to weekly charts recommended
SMAs excel here due to their slow, stable nature
Can add EMA 200 for comparison
Investment Analysis (Very Long Timeframes):
SMAs only: 100, 200, 300
Weekly to monthly charts
SMA's slow calculation filters noise perfectly for long-term trends
EMA Timeframe-Specific Recommendations
📌 Important Notes on EMA Usage by Timeframe:
Small Timeframes (5-minute and 15-minute charts):
Use 9 EMA and 21 EMA
These fast EMAs respond quickly to price changes
Perfect for scalping and day trading
The 9/21 EMA crossover is a popular day trading strategy
Medium Timeframes (1-hour to 4-hour charts):
Use 21 EMA and 50 EMA
Balances responsiveness with trend reliability
Ideal for swing trading and intraday position holding
The 21/50 EMA combination filters out noise while staying responsive
Long Timeframes (Daily and Weekly charts):
Use 50 EMA and 200 EMA
The classic trend-following combination
50 EMA for medium-term trend, 200 EMA for major trend
The 50/200 EMA crossover is known as the "Golden Cross" (bullish) or "Death Cross" (bearish)
For very long-term analysis on these timeframes, consider using SMAs instead
Quick Reference Guide:
5m / 15m: EMA 9 & 21
1h / 4h: EMA 21 & 50
1D / 1W: EMA 50 & 200 (or switch to SMAs for even smoother signals)
Practical Trading Strategy with EMAs
📌 Why Use EMAs for Active Trading:
For active trading, use EMAs because they have faster movement compared to SMAs. This faster response to price changes allows you to catch trends earlier and exit trades before major reversals occur.
Three-EMA Trading System:
1. 9 EMA - Quick Trend Recognition:
Use the 9 EMA to understand the trend quickly
When price is above 9 EMA = Short-term uptrend
When price is below 9 EMA = Short-term downtrend
The 9 EMA reacts immediately to price momentum changes
Perfect for entry timing and quick trend identification
2. 21 EMA - Exit Signal and Trend Confirmation:
When the 21 EMA breaks (price crosses it), exit your trade
This is critical because when the 21 EMA breaks, the trend will likely reverse
The 21 EMA acts as your "stop-loss line"
Breaking the 21 EMA signals that the short-term momentum has shifted
Example: In an uptrend, when price crosses below 21 EMA, exit longs immediately
Example: In a downtrend, when price crosses above 21 EMA, exit shorts immediately
3. 50 EMA - Full Correction Understanding:
Use the 50 EMA to understand the complete correction
The 50 EMA shows where the full pullback or correction might end
When price reaches the 50 EMA, it often bounces (in a strong trend)
Breaking the 50 EMA indicates a deeper correction or potential trend reversal
Use it to gauge the strength of the overall trend
Customization Tips
Toggle unnecessary MAs off to reduce chart clutter based on your trading style and timeframe
For the 3-EMA trading strategy, enable only 9, 21, and 50 EMAs
For long timeframes (daily+), disable EMAs and use only SMAs to avoid over-reactive signals
Match your EMA selection to your timeframe using the guide above
Adjust colors to match your chart theme or to highlight specific MAs
Modify lengths to fit specific market conditions or asset volatility
Change source from close to high/low/HL2 for alternative perspectives
Use thicker lines for key decision MAs (edit linewidth in settings)
Color Scheme Rationale
EMAs (Warm Colors):
Yellow → Orange progression represents increasing timeframes while maintaining visual cohesion. The warm palette signals "active" or "fast-reacting" nature of EMAs, perfect for shorter timeframes and active trading.
SMAs (Cool Colors):
Blue → Purple progression provides clear visual distinction from EMAs. The cool palette suggests "stable," "slow," and "smooth" characteristics of SMAs, ideal for long timeframe analysis.
What Makes This Different?
Unlike basic MA indicators, Multi-MA Suite provides:
Both EMA and SMA in one indicator (saves indicator slots)
Optimized MA selection based on speed characteristics - fast EMAs for short timeframes, slow SMAs for long timeframes
Clear timeframe-specific EMA recommendations for immediate use
Practical trading strategy included - 9 EMA for trend, 21 EMA for exit, 50 EMA for corrections
Individual control over each MA (toggle, color, parameters)
Thoughtful default settings based on widely-used trading periods
Color-coded system for instant visual differentiation
Clean, organized interface for efficient workflow
Installation & Usage
Add the indicator to your chart
Open indicator settings to customize
For active trading: Enable 9, 21, and 50 EMAs (the recommended trading system)
Select appropriate MAs for your timeframe (use the EMA timeframe guide above)
Toggle MAs on/off based on your analysis needs
Adjust colors if desired to match your chart theme
Modify lengths and sources as needed for your strategy
⚠️ IMPORTANT DISCLAIMER
EDUCATIONAL AND INFORMATIONAL PURPOSES ONLY
This indicator and its accompanying documentation are provided for educational and informational purposes only. The content does not constitute financial advice, investment advice, trading advice, or any other sort of advice, and you should not treat any of the indicator's content as such.
NO GUARANTEE OF RESULTS
Past performance is not indicative of future results. The strategies, techniques, and concepts discussed herein are provided "as is" without any warranty of any kind. Trading and investing in financial markets involves substantial risk of loss and is not suitable for every investor.
RISK ACKNOWLEDGMENT
You can lose money trading: Trading stocks, forex, futures, options, cryptocurrencies, and other financial instruments carries a high level of risk and may not be suitable for all investors. You may sustain a total loss of your investment.
No guaranteed profits: The use of moving averages or any technical indicator does not guarantee profitable trades. Markets can remain irrational longer than you can remain solvent.
Lagging indicators: All moving averages are lagging indicators based on historical price data and may not predict future price movements.
False signals: Moving averages can produce false signals, especially in choppy, sideways, or low-volume market conditions.
YOUR RESPONSIBILITY
Do your own research: Before making any trading or investment decision, you should conduct your own research and due diligence.
Consult professionals: Consider seeking advice from qualified financial advisors, certified public accountants, or licensed professionals before making financial decisions.
Risk management: Always use proper risk management, including stop-losses, position sizing, and diversification.
Demo trading: Test any strategy on a demo account before risking real capital.
Understand the markets: Ensure you fully understand the markets you're trading and the risks involved.
PERSONAL TRADING DECISIONS
All trading decisions are made at your own discretion and at your own risk. You are solely responsible for all trading decisions you make. The strategies mentioned (including the 9/21/50 EMA system) are examples only and should not be followed blindly without proper testing and risk assessment.
MARKET CONDITIONS VARY
Market conditions change constantly. What works in one market condition may not work in another. Trending strategies (like the ones discussed) typically perform poorly in ranging markets. Adapt your approach based on current market conditions.
USE AT YOUR OWN RISK
By using this indicator, you acknowledge that you have read this disclaimer and agree to be bound by its terms. If you do not agree with any part of this disclaimer, do not use this indicator.
Advanced Power Index (GGE)# Advanced Power Index (GGE)
## Overview
The Advanced Power Index is a momentum oscillator that provides faster and more responsive signals compared to traditional RSI indicators. It uses direct summation calculations instead of exponential smoothing, making it particularly effective for short to medium-term trading.
## Key Features
- **Faster Response**: Reacts more quickly to price changes than standard RSI
- **Clearer Signals**: Provides sharper, more defined momentum shifts
- **Customizable Levels**: Overbought (68) and Oversold (32) zones
- **Visual Alerts**: Color-coded plot and background highlighting for critical zones
- **Adaptive**: Works well in both trending and ranging markets
## How It Works
The indicator calculates the ratio between positive and negative price changes over a specified period, converting this into a 0-100 scale oscillator. Unlike traditional RSI which uses Wilder's smoothing method, this approach delivers more immediate signals for momentum changes.
## Trading Applications
### 1. Overbought/Oversold Strategy
- **Oversold (< 32)**: Potential buying opportunity when indicator rises back above 32
- **Overbought (> 68)**: Potential selling opportunity when indicator falls back below 68
### 2. Midline Crossovers
- **Above 50**: Bullish momentum, consider long positions
- **Below 50**: Bearish momentum, consider short positions
### 3. Divergence Trading
- **Bullish Divergence**: Price makes lower lows while indicator makes higher lows
- **Bearish Divergence**: Price makes higher highs while indicator makes lower highs
### 4. Trend Following
- In uptrends: Use pullbacks to the 50 level as entry points
- In downtrends: Use rallies to the 50 level as exit/short points
## Color Coding
- **Green**: Strong bullish momentum (> 68)
- **Red**: Strong bearish momentum (< 32)
- **Yellow**: Neutral zone (32-68)
## Settings
- **Period**: Default 14, adjustable based on your trading timeframe
- **Price Type**: Close, Open, High, Low, or custom source
- **Highlight Zones**: Toggle background highlighting for critical levels
## Best Timeframes
- Most effective on 5-minute to 4-hour charts
- Ideal for day trading and scalping strategies
- Can be combined with trend indicators for confirmation
## Tips for Use
- Don't use in isolation - combine with volume, support/resistance levels
- Works best in liquid, actively traded markets
- Consider using alongside moving averages or MACD
- Always implement proper risk management and stop-losses
## Advantages Over Standard RSI
✓ Faster signal generation
✓ Less lag in volatile markets
✓ Better suited for short-term trading
✓ Clearer momentum shifts
✓ More responsive to sudden price changes
---
**Note**: No indicator is perfect. Always use proper risk management and combine multiple forms of analysis before making trading decisions.
**Disclaimer**: This indicator is for educational and informational purposes only. Past performance does not guarantee future results. Trading involves substantial risk of loss.
TradingView.To Strategy Template (with Dyanmic Alerts)Hello traders,
If you're tired of manual trading and looking for a solid strategy template to pair with your indicators, look no further.
This Pine Script v5 strategy template is engineered for maximum customization and risk management.
Best part?
This Pine Script v5 template facilitates the dynamic construction of TradingView.TO alerts, sparing users the time and effort of mastering the TradingView.TO syntax and manually create alert commands.
This powerful tool gives much power to those who don't know how to code in Pinescript and want to automate their indicators' signals via TradingView.TO bot.
IMPORTANT NOTES
TradingView.TO is a trading bot software that forwards TradingView alerts to your brokers (examples: Binance, Oanda, Coinbase, Bybit, Metatrader 4/5, ...) for automating trading.
Many traders don't know how to create TradingView.TO dynamically-compatible alerts using the data from their TradingView scripts.
Traders using trading bots want their alerts to reflect the stop-loss/take-profit/trailing-stop/stop-loss to break options from your script and then create the orders accordingly.
This script showcases how to create TradingView.TO alerts dynamically.
TRADINGVIEW ALERTS
1) You'll have to create one alert per asset X timeframe = 1 chart.
Example: 1 alert for BTC/USDT on the 5 minutes chart, 1 alert for BTC/USDT on the 15-minute chart (assuming you want your bot to trade the BTC/USDT on the 5 and 15-minute timeframes)
2) Select the Order fills and alert() function calls condition
3) For each alert, the alert message is pre-configured with the text below
{{strategy.order.alert_message}}
Please leave it as it is.
It's a TradingView native variable that will fetch the alert text messages built by the script.
4) TradingView.TO uses webhook technology - setting a webhook URL from the alerts notifications tab is required.
KEY FEATURES
I) Modular Indicator Connection
* plug your existing indicator into the template.
* Only two lines of code are needed for full compatibility.
Step 1: Create your connector
Adapt your indicator with only 2 lines of code and then connect it to this strategy template.
To do so:
1) Find in your indicator where the conditions print the long/buy and short/sell signals.
2) Create an additional plot as below
I'm giving an example with a Two moving averages cross.
Please replicate the same methodology for your indicator, whether a MACD , ZigZag, Pivots , higher-highs, lower-lows or whatever indicator with clear buy and sell conditions.
//@version=5
indicator("Supertrend", overlay = true, timeframe = "", timeframe_gaps = true)
atrPeriod = input.int(10, "ATR Length", minval = 1)
factor = input.float(3.0, "Factor", minval = 0.01, step = 0.01)
= ta.supertrend(factor, atrPeriod)
supertrend := barstate.isfirst ? na : supertrend
bodyMiddle = plot(barstate.isfirst ? na : (open + close) / 2, display = display.none)
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color = color.green, style = plot.style_linebr)
downTrend = plot(direction < 0 ? na : supertrend, "Down Trend", color = color.red, style = plot.style_linebr)
fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps = false)
fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps = false)
buy = ta.crossunder(direction, 0)
sell = ta.crossunder(direction, 0)
//////// CONNECTOR SECTION ////////
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title = "Signal", display = display.data_window)
//////// CONNECTOR SECTION ////////
Important Notes
🔥 The Strategy Template expects the value to be exactly 1 for the bullish signal and -1 for the bearish signal
Now, you can connect your indicator to the Strategy Template using the method below or that one.
Step 2: Connect the connector
1) Add your updated indicator to a TradingView chart
2) Add the Strategy Template as well to the SAME chart
3) Open the Strategy Template settings, and in the Data Source field, select your 🔌Connector🔌 (which comes from your indicator)
Note it doesn’t have to be named 🔌Connector🔌 - you can name it as you want - however, I recommend an explicit name you can easily remember.
From then, you should start seeing the signals and plenty of other stuff on your chart.
🔥 Note that whenever you update your indicator values, the strategy statistics and visuals on your chart will update in real-time
II) BOT Risk Management:
- Max Drawdown:
Mode: Select whether the max drawdown is calculated in percentage (%) or USD.
Value: If the max drawdown reaches this specified value, set a value to halt the bot.
- Max Consecutive Days:
Use Max Consecutive Days BOT Halt: Enable/Disable halting the bot if the max consecutive losing days value is reached.
- Max Consecutive Days: Set the maximum number of consecutive losing days allowed before halting the bot.
- Max Losing Streak:
Use Max Losing Streak: Enable/Disable a feature to prevent the bot from taking too many losses in a row.
- Max Losing Streak Length: Set the maximum length of a losing streak allowed.
Margin Call:
- Use Margin Call: Enable/Disable a feature to exit when a specified percentage away from a margin call to prevent it.
Margin Call (%): Set the percentage value to trigger this feature.
- Close BOT Total Loss:
Use Close BOT Total Loss: Enable/Disable a feature to close all trades and halt the bot if the total loss is reached.
- Total Loss ($): Set the total loss value in USD to trigger this feature.
Intraday BOT Risk Management:
- Intraday Losses:
Use Intraday Losses BOT Halt: Enable/Disable halting the bot on reaching specified intraday losses.
Mode: Select whether the intraday loss is calculated in percentage (%) or USD.
- Max Intraday Losses (%): Set the value for maximum intraday losses.
Limit Intraday Trades:
- Use Limit Intraday Trades: Enable/Disable a feature to limit the number of intraday trades.
- Max Intraday Trades: Set the maximum number of intraday trades allowed.
Restart Intraday EA:
III) Order Types and Position Sizing
- Choose between market or limit orders.
- Set your position size directly in the template.
Please use the position size from the “Inputs” and not the “Properties” tab.
I know it's redundant. - the template needs this value from the "Inputs" tab to build the alerts, and the Backtester needs it from the "Properties" tab.
IV) Advanced Take-Profit and Stop-Loss Options
- Choose to set your SL/TP in either USD or percentages.
- Option for multiple take-profit levels and trailing stop losses.
- Move your stop loss to break even +/- offset in USD for “risk-free” trades.
V) Miscellaneous:
Retry order openings if they fail.
Order Types:
Select and specify order type and price settings.
Position Size:
Define the type and size of positions.
Leverage:
Leverage settings, including margin type and hedge mode.
Session:
Limit trades to specific sessions.
Dates:
Limit trades to a specific date range.
Trades Direction:
Direction: Specify the market direction for opening positions.
VI) Logger
The TradingView.TO commands are logged in the TradingView logger.
You'll find more information about it in this TradingView blog post .
WHY YOU MIGHT NEED THIS TEMPLATE
1) Transform your indicator into a TradingView.TO trading bot more easily than before
Connect your indicator to the template
Create your alerts
Set your EA settings
2) Save Time
Auto-generated alert messages for TradingView.TO.
I tested them all and checked with the support team what could/couldn’t be done.
3) Be in Control
Manage your trading risks with advanced features.
4) Customizable
Fits various trading styles and asset classes.
REQUIREMENTS
* Make sure you have your TradingView.TO account
* If there is any issue with the template, ask me in the comments section - I’ll answer quickly.
BACKTEST RESULTS FROM THIS POST
1) I connected this strategy template to a dummy Supertrend script.
I could have selected any other indicator or concept for this script post.
I wanted to share an example of how you can quickly upgrade your strategy, making it compatible with TradingView.TO.
2) The backtest results aren't relevant for this educational script publication.
I used realistic backtesting data but didn't look too much into optimizing the results, as this isn't the point of why I'm publishing this script.
This strategy is a template to be connected to any indicator - the sky is the limit. :)
3) This template is made to take 1 trade per direction at any given time.
Pyramiding is set to 1 on TradingView.
The strategy default settings are:
* Initial Capital: 100000 USD
* Position Size: 1%
* Commission Percent: 0.075%
* Slippage: 1 tick
* No margin/leverage used
ProfitView Strategy TemplateHello traders,
This script took me a full week of coding/testing, sweat, and tears - and I’m too nice as I’m giving it for free to the community.
If you're tired of manual trading and looking for a solid strategy template to pair with your indicators, look no further.
This Pine Script v5 strategy template is engineered for maximum customization and risk management.
Best part?
This Pine Script v5 template facilitates the dynamic construction of ProfitView alerts, sparing users the time and effort of mastering the ProfitView syntax and manually creating alert commands.
This powerful tool gives much power to those who don't know how to code in Pinescript and want to automate their indicators' signals via the ProfitView Chrome extension.
IMPORTANT NOTES
ProfitView is a trading bot software that forwards TradingView alerts to your brokers (examples: Binance, Oanda, Coinbase, Bybit, etc.) for automating trading.
Many traders don't know how to dynamically create ProfitView-compatible alerts using the data from their TradingView scripts.
Traders using trading bots want their alerts to reflect the stop-loss/take-profit/trailing-stop/stop-loss to break options from your script and then create the orders accordingly.
This script showcases how to create ProfitView alerts dynamically.
TRADINGVIEW ALERTS
1) You'll have to create one alert per asset X timeframe = 1 chart.
Example: 1 alert for EUR/USD on the 5 minutes chart, 1 alert for EUR/USD on the 15-minute chart (assuming you want your bot to trade the EUR/USD on the 5 and 15-minute timeframes)
2) Select the Order fills and alert() function calls condition
3) For each alert, the alert message is pre-configured with the text below
{{strategy.order.alert_message}}
Please leave it as it is.
It's a TradingView native variable that will fetch the alert text messages built by the script.
4) ProfitView doesn't use webhook technology, so setting a webhook URL from the alerts notifications tab is unnecessary.
KEY FEATURES
I) Modular Indicator Connection
* plug your existing indicator into the template.
* Only two lines of code are needed for full compatibility.
Step 1: Create your connector
Adapt your indicator with only 2 lines of code and then connect it to this strategy template.
To do so:
1) Find in your indicator where the conditions print the long/buy and short/sell signals.
2) Create an additional plot as below
I'm giving an example with a Two moving averages cross.
Please replicate the same methodology for your indicator, whether a MACD , ZigZag, Pivots , higher-highs, lower-lows or whatever indicator with clear buy and sell conditions.
//@version=5
indicator("Supertrend", overlay = true, timeframe = "", timeframe_gaps = true)
atrPeriod = input.int(10, "ATR Length", minval = 1)
factor = input.float(3.0, "Factor", minval = 0.01, step = 0.01)
= ta.supertrend(factor, atrPeriod)
supertrend := barstate.isfirst ? na : supertrend
bodyMiddle = plot(barstate.isfirst ? na : (open + close) / 2, display = display.none)
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color = color.green, style = plot.style_linebr)
downTrend = plot(direction < 0 ? na : supertrend, "Down Trend", color = color.red, style = plot.style_linebr)
fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps = false)
fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps = false)
buy = ta.crossunder(direction, 0)
sell = ta.crossunder(direction, 0)
//////// CONNECTOR SECTION ////////
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title = "Signal", display = display.data_window)
//////// CONNECTOR SECTION ////////
Important Notes
🔥 The Strategy Template expects the value to be exactly 1 for the bullish signal and -1 for the bearish signal
Now, you can connect your indicator to the Strategy Template using the method below or that one.
Step 2: Connect the connector
1) Add your updated indicator to a TradingView chart
2) Add the Strategy Template as well to the SAME chart
3) Open the Strategy Template settings, and in the Data Source field, select your 🔌Connector🔌 (which comes from your indicator)
Note it doesn’t have to be named 🔌Connector🔌 - you can name it as you want - however, I recommend an explicit name you can easily remember.
From then, you should start seeing the signals and plenty of other stuff on your chart.
🔥 Note that whenever you update your indicator values, the strategy statistics and visuals on your chart will update in real-time
II) BOT Risk Management:
- Max Drawdown:
Mode: Select whether the max drawdown is calculated in percentage (%) or USD.
Value: If the max drawdown reaches this specified value, set a value to halt the bot.
- Max Consecutive Days:
Use Max Consecutive Days BOT Halt: Enable/Disable halting the bot if the max consecutive losing days value is reached.
- Max Consecutive Days: Set the maximum number of consecutive losing days allowed before halting the bot.
- Max Losing Streak:
Use Max Losing Streak: Enable/Disable a feature to prevent the bot from taking too many losses in a row.
- Max Losing Streak Length: Set the maximum length of a losing streak allowed.
Margin Call:
- Use Margin Call: Enable/Disable a feature to exit when a specified percentage away from a margin call to prevent it.
Margin Call (%): Set the percentage value to trigger this feature.
- Close BOT Total Loss:
Use Close BOT Total Loss: Enable/Disable a feature to close all trades and halt the bot if the total loss is reached.
- Total Loss ($): Set the total loss value in USD to trigger this feature.
Intraday BOT Risk Management:
- Intraday Losses:
Use Intraday Losses BOT Halt: Enable/Disable halting the bot on reaching specified intraday losses.
Mode: Select whether the intraday loss is calculated in percentage (%) or USD.
- Max Intraday Losses (%): Set the value for maximum intraday losses.
Limit Intraday Trades:
- Use Limit Intraday Trades: Enable/Disable a feature to limit the number of intraday trades.
- Max Intraday Trades: Set the maximum number of intraday trades allowed.
Restart Intraday EA:
- Use Restart Intraday EA: Enable/Disable a feature to restart the bot at the first bar of the next day if it has been stopped with an intraday risk management safeguard.
III) Order Types and Position Sizing
- Choose between market, limit, or stop orders.
- Set your position size directly in the template.
Please use the position size from the “Inputs” and not the “Properties” tab.
I know it's redundant. - the template needs this value from the "Inputs" tab to build the alerts, and the Backtester needs it from the "Properties" tab.
IV) Advanced Take-Profit and Stop-Loss Options
- Choose to set your SL/TP in either pips or percentages.
- Option for multiple take-profit levels and trailing stop losses.
- Move your stop loss to break even +/- offset in pips for “risk-free” trades.
V) Miscellaneous
Retry order openings if they fail.
Order Types:
Select and specify order type and price settings.
Position Size:
Define the type and size of positions.
Leverage:
Leverage settings, including margin type and hedge mode.
Session:
Limit trades to specific sessions.
Dates:
Limit trades to a specific date range.
Trades Direction:
Direction: Specify the market direction for opening positions.
VI) Notifications (Telegram/Discord/Email/IFTTT/Twilio/SMS)
Customize notifications sent to Telegram, Discord, Email, IFTTT, Twilio, and ProfitView Logger.
VII) Logger
The ProfitView commands are logged in the TradingView logger.
You'll find more information about it in this TradingView blog post .
WHY YOU MIGHT NEED THIS TEMPLATE
1) Transform your indicator into a ProfitView trading bot more easily than before
Connect your indicator to the template
Create your alerts
Set your EA settings
2) Save Time
Auto-generated alert messages for ProfitView.
I tested them all and checked with the support team what could/couldn’t be done.
3) Be in Control
Manage your trading risks with advanced features.
4) Customizable
Fits various trading styles and asset classes.
REQUIREMENTS
* Make sure you have your ProfitView account and do the settings correctly in your Chrome extension. If you don't know how to do it, read the documentation + ask for help in the ProfitView Discord support channel.
* If there is any issue with the template, ask me in the comments section - I’ll answer quickly.
BACKTEST RESULTS FROM THIS POST
1) I connected this strategy template to a dummy Supertrend script.
I could have selected any other indicator or concept for this script post.
I wanted to share an example of how you can quickly upgrade your strategy, making it compatible with ProfitView.
2) The backtest results aren't relevant for this educational script publication.
I used realistic backtesting data but didn't look too much into optimizing the results, as this isn't the point of why I'm publishing this script.
This strategy is a template to be connected to any indicator - the sky is the limit. :)
3) This template is made to take 1 trade per direction at any given time.
Pyramiding is set to 1 on TradingView.
The strategy default settings are:
* Initial Capital: 100000 USD
* Position Size: 1%
* Commission Percent: 0.075%
* Slippage: 1 tick
* No margin/leverage used
Best regards,
Dave





















